<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form method="post" action="updateBook">
    <table>
        <tr>
            <td><input type="hidden" name="id" value="${bookManage.id}"></td>
        </tr>
        <tr>
            <td>图书名称</td>
            <td><input type="text" name="name" value="${bookManage.name}"></td>
        </tr>
        <tr>
            <td>图书作者</td>
            <td><input type="text" name="author" value="${bookManage.author}"></td>
        </tr>
        <tr>
            <td>购买时间</td>
            <td>
                <c:choose>
                    <c:when test="${not empty bookManage.time}">
                        <input type="text" value='<fmt:formatDate value="${bookManage.time}" pattern="yyyy-MM-dd"/>'>
                    </c:when>
                    <c:otherwise>
                        <input type="text" value="未设置时间">
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
        <tr>
            <td>图书类别</td>
            <td>
                <select name="type">
                    <option value="1" ${bookManage.type == 1? 'selected' : ''}>计算机/软件</option>
                    <option value="2" ${bookManage.type == 2? 'selected' : ''}>小说/文摘</option>
                    <option value="3" ${bookManage.type == 3? 'selected' : ''}>杂项</option>
                </select>
            </td>
        </tr>
        <tr>
            <td><input type="submit" value="提交"></td>
        </tr>
    </table>
</form>
</body>
</html>